//
//  HttpUrl.h
//  mengbutou
//
//  Created by Jiafei Wei on 16/6/30.
//  Copyright © 2016年 Jiafei Wei. All rights reserved.
//
//#define apiUrl @"http://www.aiaiaini.com/demo/web/index.php?r=api"
#define apiUrl @"http://server.i-wphone.com/index.php?r=api"
#define uploadUrl @"/file/upload&user_id="//文件上传
#define downloadUrl @"/file/download"

#define getChatRecord @"/chat/get-records"//获取聊天记录
#define uploadChatRecodeUrl @"/chat/upload-record&user_id="//上传聊天记录
#define easeUpLoadFile @"/chat/up-file"

#define getsportRecord @"/sport/get-sports"
#define getsportrecorditem @"/sport/get-paths"
#define getStatistics @"/sport/get-statistics"

#define getTodayStep @"/step/get-today"
#define getTodayStepList @"/step/get-today"
#define getRankStep @"/step/get-walks"

#define saveSetting @"/setting/save"
#define getSetting @"/setting/get-settings"

#define getBindTerminals @"/watch/get-bind-terminals"
#define getBind @"/watch/get-bind"
#define unbindWatch @"/watch/un-bind"
#define bindWatch @"/watch/bind"

#define updateUser @"/user/update-user&user_id="
#define getUser @"/user/get-user"

#define addMark @"/mark/add-mark"
#define getAllMark @"/mark/get-all-marks"
#define deleteMark @"/mark/delete-mark"
#define deleteAllMark @"/mark/delete-all-mark"
#define saveMark @"/mark/save-mark"
#define getUsers @"/user/get-users"
#define saveContact @"/user/save-contact"
#define checkUser @"/user/check-is-user"
#import <Foundation/Foundation.h>
@interface HttpTool : NSObject
/**
 *  发送get请求
 *
 *  @param URLString  请求的基本的url
 *  @param parameters 请求的参数字典
 *  @param success    请求成功的回调
 *  @param failure    请求失败的回调
 */
+ (void)GET:(NSString *)URLString WithHeader:(BOOL)is
 parameters:(id)parameters
    success:(void (^)(id responseObject))success
    failure:(void (^)(NSError *error))failure;


/**
 *  发送post请求
 *
 *  @param URLString  请求的基本的url
 *  @param parameters 请求的参数字典
 *  @param success    请求成功的回调
 *  @param failure    请求失败的回调
 */
+ (void)Post:(NSString *)URLString
  parameters:(id)parameters
     success:(void (^)(id responseObject))success
     failure:(void (^)(NSError *error))failure;

+(void)update:(NSString *)URLString
   parameters:(id)parameters
     filePath:(NSString *)filePath
     fileName:(NSString*)fileName
     dataName:(NSString *)name
      success:(void (^)(id responseObject))success
      failure:(void (^)(NSError *error))failure;

+(NSString*)getMIMEType:(NSString *)path;//获取文件类型

/**
 *  发送post请求
 *
 *  @param URLString  请求的基本的url
 *  @param parameters 请求的参数字典
 *  @param success    请求成功的回调
 *  @param failure    请求失败的回调
 */
+ (void)Post2:(NSString *)URLString
  parameters:(id)parameters
     success:(void (^)(id responseObject2))success
     failure:(void (^)(NSError *error))failure;
/**
 *  下载
 *
 *  @param URLString  请求的基本的url
 *  @param parameters 请求的参数字典
 *  @param success    请求成功的回调
 */
+(void)downFileFromServerz:(NSString *)URLString fileName:(NSString *)fileName completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler;
@end
